import javax.swing.ImageIcon
import java.awt.Font
import javax.swing.SwingConstants

package layoutVariety
	{
class Label (ref:Int) extends Widget(ref)
{
	var l = new scala.swing.Label
	
	//Init Widget class object 
	jc = l
	 
	//adding proper functionality
	namesToFuncs("image") = setImage
	namesToFuncs("text") = setText
	namesToFuncs("font") = setFont
	namesToFuncs("halign") = setHorizontal
	namesToFuncs("valign") = setVertical

	def setImage(ref:AnyRef)
	{
		var path = ref.asInstanceOf[String]
		var ic = new ImageIcon(path)
		l.icon = ic		
	}
	
	def getText = l.text
	
	def setText(ref:AnyRef)
	{
		var txt = ref.asInstanceOf[String]
		l.text = txt
	}
	
	def setFont(ref:AnyRef)
	{
		var tup = ref.asInstanceOf[(String,Int,Int)]
		var name = tup._1
		var style = tup._2
		var size = tup._3
		var f = new Font (name,style,size)
		l.font = f
	}
	
	def setHorizontal(ref:AnyRef)
	{
		var left0_center1_right2 = ref.asInstanceOf[Int]
		if (left0_center1_right2 == 0)
		{
			l.horizontalTextPosition = scala.swing.Alignment.Left
		}
		if (left0_center1_right2 == 1)
		{
			l.horizontalTextPosition = scala.swing.Alignment.Center
		}
		if (left0_center1_right2 == 2)
		{
			l.horizontalTextPosition = scala.swing.Alignment.Right
		}
	} 
	
	def setVertical(ref:AnyRef)
	{
		var top0_middle1_bottom2 = ref.asInstanceOf[Int]
		if (top0_middle1_bottom2 == 0)
		{
		  l.verticalTextPosition = scala.swing.Alignment.Top
		}
		if (top0_middle1_bottom2 == 1)
		{
		  l.verticalTextPosition = scala.swing.Alignment.Center
		}
		if (top0_middle1_bottom2 == 2)
		{
		  l.verticalTextPosition = scala.swing.Alignment.Bottom
		}
	}
	
}}